﻿//-----------------------------------------------------------------------
// <copyright file="CommonDelegates.cs" company="MSCRMTools">
//     Copyright © MSCRMTools. All rights reserved.
// </copyright>
// <author>tanguy92</author>
// <date>21/02/2011</date>
// <codeplexurl>http://searchablepropertyupdater.codeplex.com</codeplexurl>
// <summary>no summary</summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Tanguy.WinForm.Utilities.DelegatesHelpers
{
    public class TextBoxDelegates
    {
        internal static void SetText(TextBox control, string text)
        {
            MethodInvoker miSetText = delegate
            {
                control.Text = text;
            };

            if (control.InvokeRequired)
            {
                control.Invoke(miSetText);
            }
            else
            {
                miSetText();
            }
        }

        internal static void SetText(ICSharpCode.TextEditor.TextEditorControl control, string text)
        {
            MethodInvoker miSetText = delegate
            {
                control.Text = text;
            };

            if (control.InvokeRequired)
            {
                control.Invoke(miSetText);
            }
            else
            {
                miSetText();
            }
        }
    }
}